import { createSlice } from '@reduxjs/toolkit'

export const cityList = createSlice({
    name: 'cityList',
    initialState: {
        start: '北京',
        end: '上海'
    },
    reducers: {
        setCitys: (state, { payload: { type, city } }) => {
            state[type] = city
        },
        exChange: (state) => {
            let temp = state.start
            state.start = state.end
            state.end = temp
        }
    },
})

export const { setCitys, exChange } = cityList.actions

export default cityList.reducer